{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>好看的双栏博客</title>
    <link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
    <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/cl-css.css' %}" rel="stylesheet">
    <link href="{% static 'font-awesome/css/font-awesome.min.css' %}" rel="stylesheet">
    <link rel="stylesheet" href="{% static 'highlight/styles/railscasts.css' %}">
</head>
<body>
<div class="cl-header container-fluid" id="app">
    <div class="header-content container">
        <nav class="navbar navbar-expand-lg navbar-light">
            <a class="navbar-brand" href="/">
                <img src="../static/img/kdlk.jpg" width="144" height="72" alt="">
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
                    aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse justify-content-end" id="navbarNav">
                <ul class="navbar-nav">
                    {#                        导航栏#}
                    {#                        {% for cat in categories %}#}
                    {#                            {% if cat.id == category.id %}#}
                    {#                                <li class="nav-item active">#}
                    {#                                    <a class="nav-link" href="/?cat_id={{ cat.id }}">{{ cat.title }}</a>#}
                    {#                                </li>#}
                    {#                            {% else %}#}
                    {#                                <li class="nav-item">#}
                    {#                                    <a class="nav-link" href="/?cat_id={{ cat.id }}">{{ cat.title }}</a>#}
                    {#                                </li>#}
                    {#                            {% endif %}#}
                    {#                        {% endfor %}#}
                    <li class="nav-item dropdown" v-if="is_login">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-expanded="false">
                            {{ username }}
                        </a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="{% url 'users:writeblog' %}">写文章</a>
                            <a class="dropdown-item" href="{% url 'users:usercenter' %}">个人信息</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="{% url 'users:logout' %}">退出</a>
                        </div>
                    </li>
                    <li class="nav-item" v-else>
                        <a href="{% url 'users:login' %}" class="nav-link">登录</a>
                    </li>
                </ul>
            </div>
        </nav>
    </div>
</div>
{#enctype="multipart/form-data" 提交图片#}

<form class="col-md-6 offset-md-3" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    <div class="form-group">
        <label for="username">用户名</label>
        <input type="text" class="form-control" id="username" name="username" value="{{ username }}">
    </div>
    <!--<br><h5 class="col-md-4">暂无头像</h5><br>-->
    <br>
    {% if avatar %}
        <img src="{{ avatar }}"
             style="max-width: 20%;" class="img-thumbnail"><br>
    {% else %}
        <img src="{% static '/img/portrait.png' %}"
             style="max-width: 20%;" class="img-thumbnail"><br>
    {% endif %}

    <!-- avatar -->
    <div class="form-group">
        <label for="avatar">上传头像</label>
        <input type="file" class="form-control-file" name="avatar" id="avatar">
    </div>

    <!-- phone -->
    <div class="form-group">
        <label for="phone">电话</label>
        <input type="text" class="form-control" disabled="disabled" id="phone" name="phone" value="{{ mobile }}">
    </div>
    <!-- desc -->
    <div class="form-group">
        <label for="desc">简介</label>
        <!-- 文本区域 -->
        <textarea type="text" class="form-control" id="desc" name="desc" rows="5">{{ user_desc }}</textarea>
    </div>
    <!-- 提交按钮 -->
    <button type="submit" class="btn btn-primary" style="margin-left: 12px">修改</button>
</form>

<script src="{% static 'jquery/jquery.min.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script>
<script src="{% static 'highlight/highlight.pack.js' %}"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="{% static 'vue/vue-2.5.16.js' %}"></script>
<script src="{% static 'js/host.js' %}"></script>
<script src="{% static 'js/common.js' %}"></script>
<script src="{% static 'js/index.js' %}"></script>
<script type="text/javascript" src="{% static 'js/vue-2.5.16.js' %}"></script>
<script type="text/javascript" src="{% static 'js/axios-0.18.0.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/host.js' %}"></script>
<script type="text/javascript" src="{% static 'js/common.js' %}"></script>
<script type="text/javascript" src="{% static 'js/center.js' %}"></script>
</body>
</html>